package com.foodev.maven.gwt;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;


/**
 * @execute phase="process-resources"
 * @goal extract
 * @requiresDependencyResolution test
 * @author Martin Algesten
 */
public class ExtractNativeLibsMojo extends AbstractGwtMojo {

    /**
     * Helper class to extract the libs.
     */
    private NativeLibsExtractor extractor = new NativeLibsExtractor();


    public void execute() throws MojoExecutionException, MojoFailureException {

        try {

            extractor.extractNativeLibs(findNativeZip());

        } catch (IOException ioe) {

            getLog().error(ioe);

            throw new MojoFailureException("Failed to extract native libs.");

        }

    }

}
